package ai.restosuite.infrastructure.operation;

import org.camunda.bpm.client.ExternalTaskClient;
import org.camunda.bpm.engine.delegate.Expression;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.Map;

@SpringBootApplication
public class Application {

    private static Expression externalTopic;
    public static void main(String... args) {
        SpringApplication.run(Application.class, args);
//        createExternalTaskClient();
    }


    /**
     * 订阅topic
     */
//    private static void createExternalTaskClient(){
//        ExternalTaskClient client = ExternalTaskClient.create()
//                .baseUrl("http://localhost:8080/engine-rest")
//                .asyncResponseTimeout(10000) // long polling timeout
//                .build();
//        // subscribe to an external task topic as specified in the process
//        client.subscribe("send").lockDuration(1000).handler((externalTask, externalTaskService) -> {
//            // Put your business logic here
//
//            // Get a process variable
//            Map<String, Object> allVariables = externalTask.getAllVariables();
//
//            // Complete the task
//            externalTaskService.complete(externalTask);
//        }).open();
//    }
}
